package com.youlv.yl.util;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.security.Key;

/**
 * @author 162
 * @date 2022/1/5 23:10
 * 令牌登录
 */
public class JwtUtils {
    /**
     * 生成令牌
     * @param msg 牌携带的数据
     */
    public static String createToken(String msg) {
        return Jwts.builder().signWith(SignatureAlgorithm.HS256,"study" + System.currentTimeMillis()) .setSubject(msg).compact();
    }

    /**
     * 生成密钥
     */
    public static void main(String[] args) {
        System.err.println(createToken("测试"));
    }
}
